package com.dmz.workflow.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dmz.workflow.base.BaseServiceImpl;
import com.dmz.workflow.dao.FormPermiMapper;
import com.dmz.workflow.service.WorkflowFormPermiService;
import com.dmz.workflow.entity.FormPermi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class WorkflowFormPermiServiceImpl extends BaseServiceImpl<FormPermiMapper, FormPermi> implements WorkflowFormPermiService {

    @Autowired
    private FormPermiMapper formPermiMapper;

    @Override
    public List<FormPermi> queryFormPermiName(List<Integer> formIds) {
        QueryWrapper<FormPermi> queryWrapper = new QueryWrapper();
        queryWrapper.select("GROUP_CONCAT( permi_name ) AS permi_name", "info_id");
        queryWrapper.lambda().in(FormPermi::getInfoId, formIds).groupBy(FormPermi::getInfoId);
        return formPermiMapper.selectList(queryWrapper);
    }
}
